/**
 * 比较两个对象的属性与值是否一致
 * 
 * @param {object} value1 The first value. 
 * @param {object} value2 The second value.
 * @returns {Boolean}  true or false
 * 
 * ```
 * let a = { value: 'a' };
 * let b = { value: 'b' };
 * let result = isObjectEqual(a, b);
 * ```
 */

function isObjectEqual(value1, value2) {
  const firstEntity = Object.entries(value1);
  const seconeEntity = Object.entries(value2);

  if (firstEntity.length !== seconeEntity.length) return false;
  
  for (let index = 0; index < firstEntity.length; index++) {
    const [key1, value1] = firstEntity[index];
    const [key2, value2] = seconeEntity[index];


    if (key1 !== key2 || value1 !== value2) {
      return false;
    }
  }
  return true;
}

module.exports = isObjectEqual;